/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "servicios_det", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ServiciosDet.findAll", query = "SELECT s FROM ServiciosDet s"),
    @NamedQuery(name = "ServiciosDet.findByProdCod", query = "SELECT s FROM ServiciosDet s WHERE s.serviciosDetPK.prodCod = :prodCod"),
    @NamedQuery(name = "ServiciosDet.findBySerCod", query = "SELECT s FROM ServiciosDet s WHERE s.serviciosDetPK.serCod = :serCod"),
    @NamedQuery(name = "ServiciosDet.findByCosto", query = "SELECT s FROM ServiciosDet s WHERE s.costo = :costo"),
    @NamedQuery(name = "ServiciosDet.findByCantidad", query = "SELECT s FROM ServiciosDet s WHERE s.cantidad = :cantidad")})
public class ServiciosDet implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ServiciosDetPK serviciosDetPK;
    @Column(name = "costo")
    private Integer costo;
    @Column(name = "cantidad")
    private Integer cantidad;
    @JoinColumn(name = "ser_cod", referencedColumnName = "ser_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Servicios servicios;
    @JoinColumn(name = "prod_cod", referencedColumnName = "prod_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Productos productos;

    public ServiciosDet() {
    }

    public ServiciosDet(ServiciosDetPK serviciosDetPK) {
        this.serviciosDetPK = serviciosDetPK;
    }

    public ServiciosDet(int prodCod, int serCod) {
        this.serviciosDetPK = new ServiciosDetPK(prodCod, serCod);
    }

    public ServiciosDetPK getServiciosDetPK() {
        return serviciosDetPK;
    }

    public void setServiciosDetPK(ServiciosDetPK serviciosDetPK) {
        this.serviciosDetPK = serviciosDetPK;
    }

    public Integer getCosto() {
        return costo;
    }

    public void setCosto(Integer costo) {
        this.costo = costo;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Servicios getServicios() {
        return servicios;
    }

    public void setServicios(Servicios servicios) {
        this.servicios = servicios;
    }

    public Productos getProductos() {
        return productos;
    }

    public void setProductos(Productos productos) {
        this.productos = productos;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (serviciosDetPK != null ? serviciosDetPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ServiciosDet)) {
            return false;
        }
        ServiciosDet other = (ServiciosDet) object;
        if ((this.serviciosDetPK == null && other.serviciosDetPK != null) || (this.serviciosDetPK != null && !this.serviciosDetPK.equals(other.serviciosDetPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.ServiciosDet[ serviciosDetPK=" + serviciosDetPK + " ]";
    }
    
}
